/**
 * 功能测试管理初始化
 */
var Test = {
    layerIndex: -1
};

/**
 * 点击添加功能测试
 */
Test.openAddTest = function () {
    var index = layer.open({
        type: 2,
        title: '添加功能测试',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/test/test_add'
    });
    this.layerIndex = index;
};

/**
 * 打开查看功能测试详情
 */
Test.openTestDetail = function (id) {
    var index = layer.open({
        type: 2,
        title: '功能测试详情',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/test/test_update/' + id
    });
    this.layerIndex = index;
};

/**
 * 查看功能测试详情
 */
Test.openTestView = function (id) {
	var index = layer.open({
		type: 2,
		title: '功能测试详情',
		area: ['800px', '420px'], //宽高
		fix: false, //不固定
		maxmin: true,
		content: Feng.ctxPath + '/test/test_update/' + id,
		success: function(layero, index){
			//input设置为只读
		   $("input[class='form-control']", layero.find("iframe")[0].contentWindow.document).attr("readonly",true).css({"border":"none","outline":"none","background-color":"#fff"});
		  	 //隐藏提交按钮
		   $("#ensure", layero.find("iframe")[0].contentWindow.document).hide();
		},
	});
	this.layerIndex = index;
};

/**
 * 删除功能测试
 */
Test.delete = function (id) {
    var ajax = new $ax(Feng.ctxPath + "/test/delete", function (data) {
        Feng.success("删除成功!");
        $("#refresh_TestGrid", window.parent.document).click();	//重新载入 
    }, function (data) {
        Feng.error("删除失败!" + data.responseJSON.message + "!");
    });
    ajax.set("testId", id);
    ajax.start();
};

